package org.ds.blog.service;

import org.ds.blog.model.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

/**
 * @author glx
 */
public interface UserService extends UserDetailsService {
    /**
     * 查找用户
     * @param username 用户名
     * @return User
     */
    User findUserByUsername(String username);

    /**
     * 保存用户
     * @param username 用户名
     * @param password 密码
     * @return boolean
     */
    boolean saveUser(String username,String password);

    /**
     * 加载用户
     * @param username 用户名
     * @return UserDetails
     * @throws UsernameNotFoundException 用户没找到异常
     */
    @Override
    UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;
}
